home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / tclMotif-1.4 / programs / prog32 < prev    next >
Encoding:
Text File  |  1995-06-29  |  770 b   |  31 lines

  1. # first drag and drop test
  2. # drag the label (using the middle button) from l1 to l2
  3. # and watch l2 change its label
  4. # This is the first example given in the Motif Programmers Manual for DnD
  5. xtAppInitialize -class Program
  6.  
  7. xmRowColumn .rc managed
  8. xmPushButton .rc.l1 managed -labelString "number one"
  9. xmPushButton .rc.l2 managed -labelString "number two"
  10.  
  11. .rc.l2 dropSiteRegister \
  12.     -dropProc {startDrop %dragContext} \
  13.     -numImportTargets 1 \
  14.     -importTargets COMPOUND_TEXT
  15.  
  16. proc startDrop {dragContext} {
  17.   $dragContext dropTransferStart \
  18.     -dropTransfers {{COMPOUND_TEXT .rc.l2}} \
  19.     -numDropTransfers 1 \
  20.     -transferProc {doTransfer %closure {%value}}    
  21. }
  22.  
  23. proc doTransfer {destination value} {
  24.  
  25.   $destination setValues -labelString $value
  26. }
  27.  
  28. . realizeWidget
  29.  
  30. . mainLoop
  31.